package day03;

public class Year {
    public static void main(String[] args) {
      int days= mixdays(2016,2);
        System.out.println( days);
    }
    public  static int mixdays (int year,int month){
        int maxDays = -1;

        switch (month){
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                maxDays = 31;
                break;
            case 2:
                boolean flag=years(year);
                maxDays=flag?29:28;
              //  maxDays = (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0) ? 29: 28;
                break;
            default:
                maxDays = 30;
                break;
        }

        return maxDays;
    }

    public static   boolean years( int year){
        if ((year % 400 == 0)|| (year % 4 == 0 && year % 100 != 0)){
            return  true;
        }
        return false ;

    }


}
